import RequestHttp from '@/utils/http'
import {
  SearchParams,
  ruleItem,
  ruleIdParams,
  ruleParams,
  VoListItem,
} from './model/ruleModel'

enum Api {
  index = '/api/sysMenu/index',
  store = '/api/sysMenu/store',
  show = '/api/sysMenu/show',
  update = '/api/sysMenu/update',
  destroy = '/api/sysMenu/destroy',
  voList = '/api/sysMenu/vo/list',
}

export const getRuleList = (params?: SearchParams) => {
  return RequestHttp.get<ruleItem[]>(Api.index, params)
}

export const store = (params: ruleParams) => {
  return RequestHttp.post<boolean>(Api.store, params)
}

export const show = (params: ruleIdParams) => {
  return RequestHttp.get<ruleItem>(Api.show, params)
}

export const update = (params: ruleParams) => {
  return RequestHttp.put<boolean>(Api.update, params)
}

export const destroy = (params: ruleIdParams) => {
  return RequestHttp.delete<boolean>(Api.destroy, params)
}

export const getRuleVoList = () => {
  return RequestHttp.get<VoListItem[]>(Api.voList)
}
